package com.itcoon.cloud.framework.temporal;/**
 * @author Athric Yu
 * 2024/11/15
 **/

import com.itcoon.cloud.framework.properties.TemporalPatternConfigProperties;

import java.time.LocalDate;

/**
 *
 *
 * @author Athric Yu
 * 2024/11/15
 **/
public class LongLocalDateConverter extends AbstractConverter<Long, LocalDate> {

    public LongLocalDateConverter(TemporalPatternConfigProperties.TemporalSerialization<Long, LocalDate> temporalSerialization) {
        super(temporalSerialization);
    }

    @Override
    public LocalDate parse(Long source) {
        return LocalDate.ofEpochDay(source);
    }

    @Override
    public Long format(LocalDate temporal) {
        return temporal.toEpochDay();
    }
}
